<?php

namespace app\admin\controller;
use app\common\aliyun\Aliyunmsg;
use app\common\traits\SendMessage;
use app\common\traits\Wechat;
use function GuzzleHttp\Promise\is_settled;



class We extends Admin
{
    use Wechat;
    use SendMessage;
    /**
     *查看微信token
     */
    public function index(){
        dump(self::getInstance()->access_token->getToken());
    }

    /**
     *强制更新token
     */
    public function newtoken(){
        dump(self::getInstance()->access_token->getToken(true));
    }

    /**
     *测试微信发送模板消息
     */
    public function sendTmp()
    {
        $data = [
                'userid'=>2,
                'sendid'=>3,
                'url'=>url('mobile/fenpei/index',['order_id'=>1],true,true),
                'first'=>'推送了一条意向顾客信息！',
                'keyword1'=>'张静',
                'keyword2'=>'13800001111',
                'keyword3'=>'意向客资',
                'keyword4'=>'2017-01-01',
                'keyword5'=>'ＸＸＸＸＸＸＸＸ（渠道信息）',
        ];
        $a = $this->sendWechat($data);
        dump($a);
    }
    /**
     *测试短信发送
     */
//    public function sendSms()
//    {
//        $data = [
//            'phone'=>'13012376008',
//            'sendid'=>1,
//            'orderid'=>10,
//            'param'=>[
//                'customer'=>'黄大爷wowowo,sfdsf.',
//            ],
//            'tempcode'=>"SMS_105195013"
//        ];
//        $arr = $this->sendSmss($data);
////        $array=[
////            'result'=>[
////                'success'=>false
////            ]
////        ];
//       dump($arr);
//    }

    /**
     * 阿里云云通信的测试短信
     */
    public function sendSms()
    {
        $data = [
            'phone'=>'13012376008',
            'sendid'=>1,
            'orderid'=>10,
            'param'=>[
                'customer'=>'黄大爷wowowo,sfdsf.',
            ],
            'tempcode'=>"SMS_105195013"
        ];
        $arr = $this->sendSmsstest($data);
       halt($arr);
    }



}
